/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.deployment.converter;

import br.com.deployment.entidade.registroimovel.Imovel;
import br.com.deployment.entidade.registroimovel.Operacao;
import br.com.deployment.servico.OperacaoServico;
import javax.ejb.EJB;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.FacesConverter;

/**
 *
 * @author roniere
 */
@FacesConverter(value="operacaoConverter")
public class OperacaoConverter implements Converter{
    
    @EJB
    OperacaoServico operacaoServico;
            
     @Override
    public Object getAsObject(FacesContext fc, UIComponent uic, String string) {
        Operacao operacao = new Operacao();
        operacao.setId(Integer.valueOf(string));  
        System.err.println("Object Converter"+string);
        return operacao;
    }

    @Override
    public String getAsString(FacesContext fc, UIComponent uic, Object value) {
        Operacao operacao = (Operacao) value;
        System.err.println("String Converter"+operacao.getTipo());
        return "" + operacao.getId();
    }
}
